<template>
  <view>
    <view class="medicalcon">
      <view class="medical-list" @click="toreport(item.orderNumber)" v-for="(item, index) in DiseaseCaseList"
        :key="index">
        <view class="flexrow flexbetween medical-top">
          <view class="color333">{{ item.patientName || "" }}</view>
          <view class="color999 fontsize14">{{ item.createDate || "-" }}</view>
        </view>
        <view class="medical-bot borderbot">
          <view class="">
            <view class="medical-bottitle">病情诊断</view>
            <view>{{ item.diseaseName || "-" }}</view>
          </view>
          <view class="">
            <view class="medical-bottitle">诊断医嘱</view>
            <view class="medical-botright">
              {{ item.medicalAdvice || "-" }}
            </view>
          </view>
          <view class="">
            <view class="medical-bottitle">药品处方</view>
            <view>已开药</view>
          </view>
        </view>
      </view>
      <lack v-if="DiseaseCaseList.length == 0"></lack>
      <view style="padding-bottom: 20rpx">
        <u-loadmore :status="status" v-if="DiseaseCaseList.length > 0 && blackFlage" />
      </view>
    </view>
  </view>
</template>

<script>
import { getDiseaseCaseList } from '../../api/index.js'
import Lack from "@/chronicDisease/components/lack/lack.vue";

export default {
  components: {
    Lack
  },
  data() {
    return {
      DiseaseCasequery: {
        pageNumber: 1,//	必选	Integer	页数
        pageSize: 10,//	必选	Integer	每页显示的数量
      },
      DiseaseCaseList: [],
      blackFlage: false,
      status: 'nomore'
    }
  },
  onLoad() {
    this.DiseaseCaseList = []
    this.DiseaseCasequery.pageNumber = 1
    this._getDiseaseCaseList()
  },
  onReachBottom() {
    if (this.blackFlage) {
      return;
    }
    this.DiseaseCasequery.pageNumber = this.DiseaseCasequery.pageNumber + 1;
    this._getDiseaseCaseList()
  },
  methods: {
    //获取我的病例
    _getDiseaseCaseList() {
      getDiseaseCaseList(this.DiseaseCasequery).then(res => {
        if (res.data.records.length == 0 && this.DiseaseCasequery.pageNumber != 1) {
          this.blackFlage = true
          return
        }
        this.DiseaseCaseList = this.DiseaseCaseList.concat(res.data.records)
      })
    },
    //跳转报告详情
    toreport(orderNumber) {
      uni.navigateTo({
        url: '../index/medical-report/medical-report?orderNumber=' + orderNumber
      })
    }
  }
}
</script>

<style lang="scss">
.medicalcon {
  padding: 0 40rpx;

  .medical-list {
    .medical-top {
      height: 104rpx;
      border-bottom: 2rpx solid #f7f7f7;
    }

    .medical-bot {
      width: 100%;
      padding: 12rpx 0 32rpx 0;

      >view {
        padding-top: 20rpx;
        font-size: 28rpx;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
      }

      .medical-bottitle {
        width: 260rpx;
        color: #999;
      }

      .medical-botright {
        text-align: right;
        width: calc(100% - 260rpx);
      }
    }

    .borderbot {
      border-bottom: 20rpx solid #f7f7f7;
    }
  }
}
</style>